package com.task.core.domain.info;

import java.util.List;

import org.springframework.util.CollectionUtils;

import lombok.Data;

/**
 * @author 迪迦.
 * @date 2025/1/17 14:25
 */
@Data
public class MissionDataSourceInfo {

  private List<RelationMissionSourceUseDataCountInfo> datasourceInfo;

  private Integer allCount;

  public MissionDataSourceInfo(List<RelationMissionSourceUseDataCountInfo> datasourceInfo) {
    if (!CollectionUtils.isEmpty(datasourceInfo)) {
      this.datasourceInfo = datasourceInfo;
      this.allCount = datasourceInfo.stream().mapToInt(RelationMissionSourceUseDataCountInfo::getCanUseCount).sum();
    }
  }
}
